tongfusoft.userDetail = function() {
}

tongfusoft.userDetail.prototype = {
		//返回userlist页
		userListPage : function(){
			$("#userListPage").click(function() {
				window.location.href=common.getContextPath('manager/user/listPage');
			})
		},
		
		//获取数据
		getUserDetail : function(){
			common.post('manager/user/detail/' + $("#userId").val(), {}, function(data) {
				if (data.state == 'success') {
					$('#loginName').text(data.data.loginName);
					$('#displayName').text(data.data.displayName);
					$('#email').text(data.data.email);
					$('#mobile').text(data.data.mobile);
					$('#createdBy').text(data.data.createName);
					$('#createdDate').text(data.data.createdDate);
					$('#lastUpdBy').text(data.data.lastName);
					$('#lastUpdDate').text(data.data.lastUpdDate);
				}else{
					toastr["error"]('未知错误，请联系管理员!');
				}
			});
		},
		
		//角色与用户权限列表
		userHasRoles : function() {
			common.post('manager/roleHasUsers/query', {
				"userId" : $("#userId").val()
			}, function(data) {
				var roleDate='';
				if (data.state == 'success') {
					$.each(data.data, function(index, item) {
						roleDate = item.roleName + ";";
					});
				}
				$("#userHasRole").text(roleDate);
			});
		}
		
}	
		
$(function() {
	var obj = new tongfusoft.userDetail();
	obj.getUserDetail();	
	obj.userHasRoles();
	obj.userListPage();
	
})